import request from '@/utils/request'

/**
 * 分页查询信息点列表
 */
export function pageListSensor(query) {
  return request({
    url: '/business/sensor/page/list',
    method: 'get',
    params: query
  })
}

export function listSensorByGatewayId(gatewayId) {
  return request({
    url: `/business/sensor/list/${gatewayId}`,
    method: 'get'
  })
}

// 查询信息点列表
export function listSensor(query) {
  return request({
    url: '/admin-api/business/sensor/list',
    method: 'get',
    params: query
  })
}

// 查询信息点详细
export function getSensor(sensorId) {
  return request({
    url: '/business/sensor/' + sensorId,
    method: 'get'
  })
}

// 新增信息点
export function addSensor(data) {
  return request({
    url: '/business/sensor',
    method: 'post',
    data: data
  })
}

// 修改信息点
export function updateSensor(data) {
  return request({
    url: '/business/sensor',
    method: 'put',
    data: data
  })
}

// 删除信息点
export function delSensor(sensorId) {
  return request({
    url: '/business/sensor/' + sensorId,
    method: 'delete'
  })
}

// 修改信息点采集开关
export function changeTriggerStatus(data) {
  return request({
    url: '/business/sensor/changeTriggerStatus',
    method: 'put',
    data: data
  })
}

// 修改信息点报警开关
export function changeWarnEnable(data) {
    return request({
        url: '/business/sensor/changeWarnEnable',
        method: 'put',
        data: data
    })
}

// 修改信息点采集频率
export function changeSpeed(data) {
  return request({
    url: '/business/sensor/changeSpeed',
    method: 'put',
    data: data
  })
}

// 修改信息点基本信息
export function changeInfo(data) {
  return request({
    url: '/business/sensor/changeInfo',
    method: 'put',
    data: data
  })
}
